package com.education.platform.common;

/**
 * 返回码枚举
 */
public enum ResultCode {

    SUCCESS(200, "操作成功"),
    FAILED(500, "操作失败"),
    VALIDATE_FAILED(400, "参数验证失败"),
    UNAUTHORIZED(401, "暂未登录或token已经过期"),
    FORBIDDEN(403, "没有相关权限"),

    NOT_FOUND(404, "资源未找到"),
    BUSINESS_ERROR(404, "资源未找到"),

    // 用户相关错误码 1000-1999
    USER_NOT_FOUND(1001, "用户不存在"),
    USER_ALREADY_EXISTS(1002, "用户已存在"),
    USER_DISABLED(1003, "用户已被禁用"),
    LOGIN_FAILED(1004, "登录失败"),
    LOGIN_LOCKED(1005, "登录失败次数过多，账户已锁定"),
    OLD_PASSWORD_ERROR(1006, "原密码错误"),
    SMS_CODE_INVALID(1007, "验证码无效或已过期"),
    SMS_CODE_SEND_FAILED(1008, "短信发送失败"),

    // 业务相关错误码 2000-2999
    ORDER_NOT_FOUND(2001, "订单不存在"),
    ORDER_STATUS_ERROR(2002, "订单状态错误"),
    PAYMENT_FAILED(2003, "支付失败"),
    CURRENT_STATUS_ERROR(2005, "当前状态的需求不能修改"),
    INSUFFICIENT_BALANCE(2004, "余额不足"),

    // 系统相关错误码 9000-9999
    SYSTEM_ERROR(9000, "系统错误"),
    DATABASE_ERROR(9001, "数据库错误"),
    NETWORK_ERROR(9002, "网络错误"),

    FILE_UPLOAD_ERROR(9003, "文件上传失败");

    private final Integer code;
    private final String message;

    ResultCode(Integer code, String message) {
        this.code = code;
        this.message = message;
    }

    public Integer getCode() {
        return code;
    }

    public String getMessage() {
        return message;
    }
}
